//
//  SignalCollectionViewController.m
//  Select
//
//  Created by dihuijun on 17/3/20.
//  Copyright © 2017年 Cycle. All rights reserved.
//

#import "SignalCollectionViewController.h"
#import "SignalCollectionView.h"
@interface SignalCollectionViewController ()
/**   datasource   */
@property (nonatomic, strong) NSMutableArray *datasource;
/**   collectionView   */
@property (nonatomic, strong) SignalCollectionView *collectionView;
@end

@implementation SignalCollectionViewController


/**   datasource   */
- (NSMutableArray *)datasource{
    if(!_datasource){
        _datasource = [NSMutableArray arrayWithObjects:@"张三",@"张飞",@"赵云",@"马超",@"曹操", nil];
    }
    return _datasource;
}
/**   CollectionView   */
- (SignalCollectionView *)collectionView{
    if(!_collectionView){
        _collectionView = [SignalCollectionView ShareSignalCollectionWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.view.frame.size.height)];
        //负值
        _collectionView.datasource = self.datasource;
        //得到选中的值
        _collectionView.block = ^(NSString *content,NSIndexPath *indexPath){
            NSLog(@"\n content:%@  \n indexPathRow:%zd",content,indexPath.row);
        };
    }
    return _collectionView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"collection单选";
//    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Add" style:UIBarButtonItemStyleDone target:self action:@selector(AddClick)];
    
    
    [self.view addSubview:self.collectionView];
}


//- (void)AddClick{
//    NSUInteger count = self.datasource.count;
//    for (int i=1; i<=4; i++) {
//        [self.datasource addObject:[NSString stringWithFormat:@"%lu",count+i]];
//    }
//
//    self.collectionView.datasource = self.datasource;
//    
//    [self.collectionView reloadData];
//}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
